Skip to content
This repository has been archived by the owner on Jun 26, 2023. It is now read-only.

sync pinner on every pin operation #13

Closed
wants to merge 7 commits into from
Closed

sync pinner on every pin operation #13

wants to merge 7 commits into from

Conversation

petar
Copy link

@petar petar commented Jun 29, 2021

Addresses ipfs/kubo#8149 by syncing after every Pin.

The benchmark below compares sync-on-pin vs sync-on-batch for Badge and LevelDB.
It shows that the impact of syncing on every pin operation is not significant.

BenchmarkSyncOnceBadger-10 1694 599379 ns/op
BenchmarkSyncEveryBadger-10 1406 859930 ns/op
BenchmarkSyncOnceLevelDB-10 18 59809635 ns/op
BenchmarkSyncEveryLevelDB-10 12 104517039 ns/op

We deployed the patched pinner in production on (a) collabs and (b) nft clusters.
(a) Ran for a few hours. Collab servers do not perform much if any pinning. Ran for a few hours. After restart, the server took 22mins to come online, no reindexing was triggered. FYI here, the init system that handles starting/stopping ipfs in prod sends a forceful kill to the process; if it doesn't die within a certain time of it getting the clean termination signal. This should have no relation to pinner dirty/reindexing.

@petar petar changed the title add benchmark that compares leveldb vs badger and sync-on-op vs sync-on-batch sync pinner on every pin operation Jun 29, 2021
@petar petar requested a review from aschmahmann June 29, 2021 15:53
Copy link

@aschmahmann aschmahmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not all of the operations are covered here (e.g. Update). Also, the linter is failing.

dspinner/pin.go Outdated Show resolved Hide resolved
dspinner/pin.go Show resolved Hide resolved
dspinner/pin_test.go Outdated Show resolved Hide resolved
@petar
Copy link
Author

petar commented Jul 2, 2021

@aschmahmann Take a look to see if this logging strategy looks sufficient to narrow down the issue. Added flushes to all public mutable methods.

gammazero added a commit that referenced this pull request Jul 19, 2021
This PR builds on PR #13 to sync the pinner on every pin operation. This PR does the following that #13 does not:

- Sync's dag service separately from pin data
- Does not release and immediately reacquire lock to sync, syncs while still holding pinner lock.
- Syncs only pin data for most operations

In addition to sync of pin data, this PR also revises how indexes are rebuilt.  Instead of reading through all pins and loading all previous index data, now only a single pass through the pins is needed to rebuild missing indexes resulting from incomplete add or delete operations. This is operationally much simpler, but also does not require storing entire pin sets or index sets in memory as did the previous solution.
@gammazero gammazero mentioned this pull request Jul 19, 2021
@petar
Copy link
Author

petar commented Jul 29, 2021

Subsumed by #15.

@petar petar closed this Jul 29, 2021
@petar petar deleted the fix/reindex branch July 29, 2021 15:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants